package com.qidianit.mes.pro.controller;

import com.github.pagehelper.PageInfo;
import com.qidianit.mes.pojo.Result;

import com.qidianit.mes.pojo.pro.WorkflowProduct;
import com.qidianit.mes.pro.service.WorkflowProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description:
 * @Author: wang fei long
 * @Date: 2025/9/18 0018 - 19:30
 */
@RestController
@RequestMapping("/workflowProduct")
@CrossOrigin
public class WorkflowProductController {

    @Autowired
    private WorkflowProductService workflowProductService;
    @GetMapping("/page")
    public Result<PageInfo<WorkflowProduct>> selectList(Long workflowId, @RequestParam(defaultValue = "1") int page , @RequestParam(defaultValue = "10") int size){
        return workflowProductService.selectList(workflowId,page,size);
    }

    @PostMapping("/add")
    public Result insertWorkflowProduct(@RequestBody WorkflowProduct workflowProduct){
        return workflowProductService.insertWorkflowProduct(workflowProduct);
    }

    @GetMapping("/{id}")
    public Result<WorkflowProduct> selectById(@PathVariable Long id){
        return workflowProductService.selectById(id);
    }
    @PutMapping("/update")
    public Result updateById(@RequestBody WorkflowProduct workflowProduct){
        return workflowProductService.updateById(workflowProduct);
    }
    @DeleteMapping("/delete/{id}")
    public Result deleteById(@PathVariable Long id) {
        return workflowProductService.deleteById(id);
    }
    @DeleteMapping("/batchDelete")
    public Result batchDelete(Long[] id) {
        return workflowProductService.batchDelete(id);
    }


}
